$(function(){
    var @grid = new DataGrid();
    rows:10,
    gridId:'planGrid',
    size:[550,580],
    listUrl:'plans',
    editUrl:'plans',
    formateCode:['planType'],
    formateData:[commonCodeList['planType']]
})

    /*获取公共代码赋值下拉列表*/
    $('#planType').html($grid.commonCodeToOptions(commonCodeList['playType']));

    /*生成表格*/
    $grid.createDataGrid({});

    /*修改行内数据*/
    $('#planGrid').on('click','editBtn',function(){
    var role = sessionStorage.getItem('role'),
        action = $(this).attr('role');
    if(role == 'false' && action ='edit'){
        layer.msg('没有权限操作该功能！',{time:2500,offset:'t'});
        return
    }
        $grid.editRowData(this,{
            unEditField:['planId','planType','planParam'],
            formateCode:['playType'],
            formateData:[commonCodeList['playType']],
            key:'id',
            title:'修改作业信息',
            callback:function(){
                $('#planType1').html($grid.commonCodeToOptions(commonCodeList['planType']));
            }
        })

    });

    $('.datePicker').datetimepicker({
        language:'zh-CN',
        format:'yyyy-mm-dd hh:ii:ss',
        weekStart:1,
        todayBtn：1，
        autoclost:1,
        todayHighlight:1,
        startView:2,
        minView:0,
        forceParse:0
    });

    /*搜素功能*/
    $('#submitSearch').click(function()){
        var formData = $('#search-form').formToJson();
        $grid.searchDataGrid(fromData)
    });

    /*重置功能*/
    $('#submitReset').click(function({
        $grid.searchDataGrid();
    });
})

function getRowId(elem){
    var rowId = {planId:null},
    planId = $(elem).parent().parent().siblings.eq(1).text();
    rowId['planId']=planId;
    sessionStorage.setItem('rowId',JSON.stringify(rowId));
}

function getPlanId(elem){
    var rowId = {planId:null},
    planId = $(elem).text();
    rowId['planId']=planId;
    sessionStorage.setItem('rowId',JSON.stringify(rowId));
}